#!/bin/sh
########################################################################
# Begin fcron
#
# Description : deluge-daemon
#
#
########################################################################

### BEGIN INIT INFO
# Provides:            deluged
### END INIT INFO

. /lib/lsb/init-functions
if test -f /etc/default/jellyfin; then
    . /etc/default/jellyfin
    fi
BIN_FILE="/usr/lib/jellyfin/bin/jellyfin"
#$LastChangedBy: dj $
#$Date: 2019-09-08 13:50:13 -0500 (Sun, 08 Sep 2019) $

case "$1" in
   start)
      User=jellyfin
      #EnvironmentFile=/etc/conf.d/jellyfin
      log_info_msg "Starting jellyfin..."
      start_daemon ${BIN_FILE} --datadir ${JELLYFIN_DATA_DIRECTORY} --cachedir ${JELLYFIN_CACHE_DIRECTORY} ${JELLYFIN_ADD_OPTS}&
      evaluate_retval
      ;;

   stop)
      	log_info_msg "Stopping jellyfin..."
	killproc "${BIN_FILE}"
      	evaluate_retval
      ;;
   status)
       pidof "${BIN_FILE}"
       ;;
   restart)
      $0 stop
      sleep 1
      $0 start
      ;;
   *)
      echo "Usage: $0 {start|stop|restart|status}"
      exit 1
      ;;
esac

# End /etc/init.d/fcron
